<template>
  <div v-loading="state.loading" :style="'height:' + state.height">
    <iframe
      :src="props.src"
      frameborder="no"
      style="width: 100%; height: 100%"
      scrolling="auto"
    />
  </div>
</template>
<script lang="ts" setup>
import { ref, provide, onMounted, reactive } from "vue";
// export default {
//   props: {
//     src: {
//       type: String,
//       required: true,
//     },
//   },
//   data() {
//     return {
//       height: document.documentElement.clientHeight - 94.5 + "px;",
//       loading: true,
//       url: this.src,
//     };
//   },
//   mounted: function () {
//     setTimeout(() => {
//       this.loading = false;
//     }, 300);
//     const that = this;
//     window.onresize = function temp() {
//       that.height = document.documentElement.clientHeight - 94.5 + "px;";
//     };
//   },
// };
const state: { height: any; loading: boolean; url: string } = reactive({
  loading: true,
  url: "",
  height: document.documentElement.clientHeight - 94.5 + "px;",
});
interface Props {
  src: any;
}
const props = withDefaults(defineProps<Props>(), {
  src: () => {
    return {};
  },
});
onMounted(() => {
  setTimeout(() => {
    state.loading = false;
  }, 300);

  window.onresize = function temp() {
    state.height = document.documentElement.clientHeight - 94.5 + "px;";
  };
});
</script>
